
/**
 * 菜单 js
 */
var common = {};

common.paginationQuery = function(pn) {
	var name = $("#searchKeyWords").val();
	var params = {};
	params.groupName = name;
	params.page = pn;
	server.ajaxLoadTableList({
		url:server.url + "/manage/userGroup/list",	// post请求url路径--必填
		params:params,
		paginationTable:'data-table',
		paginationFooter:'data-pagination',
		checkbox:true,
		columns:[{
			field:'groupName',	// 显示的字段, 支持 对象.字段 格式, 例如下面用户组
			title:'组名',	// 列名-title标题
			width:150,	// 列宽, 单位为px
			formatter:function(value,row){
				var result = '<a href="javascript:server.openModalBox(\'/manage/userGroup/edit/' + row.id + '/1\',\'编辑\',600);">' + value + '</a>';
				return result;
			}
		},{
			field:'updatedUser.userName',
			title:'更新人',
			width:90
		},{
			field:'updateTime',
			title:'更新时间',
			width:125,
			formatter:function(value,row){
				var updateTime = '--';
				if(value != null && value > 0){
					updateTime = new Date(value).format('yyyy-MM-dd hh:mm:ss');
				}
				return updateTime;
			}
		},{
			field:'action',	// 如果此为操作按钮时, field则应写成active, 此值固定!!!
			title:'操作',
			width:60,
			formatter:function(value,row){
				// 操作按钮
				var operationButtons = '<div class="btn-group">';
                operationButtons += '<a class="btn btn-xs btn-azure dropdown-toggle" data-toggle="dropdown" aria-expanded="false">操作 <i class="fa fa-angle-down"></i></a>';
                operationButtons += '<ul class="dropdown-menu dropdown-azure">';
                operationButtons +=  '<li><a href="javascript:server.openModalBox(\'/manage/userGroup/edit/' + row.id + '/1\',\'编辑\',600);"> 编辑</a></li>';
                operationButtons +=  '<li><a href="javascript:server.deleteObject(\''+row.id+'\',\'/manage/userGroup/delete\',common.paginationQuery,server.currentPage);"> 删除</a></li>';
                operationButtons += '</ul>';
                operationButtons +=  '</div>';
				return operationButtons;
			}
		}]
	});
}

common.validate = function(){
	if(verify.isNull($("#groupName").val())){
		server.alert("用户组名称不可为空");
		return false;
	}
	return true;
}
